package com.gitee.wsl.platform


class JvmArchFinder : ArchFinder {
    private val _arch by lazy {
        getCurrentArchFromJVMProperty()
    }

    private fun getCurrentArchFromJVMProperty(): Arch {
        val osString = System.getProperty("os.arch").lowercase()
        return requireNotNull(Arch.fromString(osString)) {
            "this arch is not recognized: $osString"
        }
    }

    override fun getCurrentArch(): Arch {
        return _arch
    }

    companion object  {
        val instance = JvmArchFinder()
      }
}